package com.zde.moriserver.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import lombok.Data;
import org.dromara.autotable.annotation.ColumnComment;
import org.dromara.autotable.annotation.ColumnDefault;
import org.dromara.autotable.annotation.mysql.MysqlTypeConstant;
import org.dromara.mpe.autotable.annotation.ColumnId;
import org.dromara.mpe.autotable.annotation.Table;
import org.dromara.mpe.processer.annotation.AutoDefine;
import org.dromara.mpe.processer.annotation.AutoMapper;
import org.dromara.mpe.processer.annotation.AutoRepository;

//https://www.yuque.com/dontang/codewiki/owoykf
@AutoDefine // 新增
@AutoMapper // 新增
@AutoRepository // 新增
// @Data自动生成set get方法
@Data
@Table(value = "zde_users", comment = "测试表")
public class UsersEntity {

    @ColumnComment("id")
    @ColumnId(mode = IdType.AUTO, comment = "id主键", type = MysqlTypeConstant.BIGINT, length = 32)
    private String id;

    @ColumnComment("用户名")
    private String username;

    @ColumnComment("密码")
    private String password;

    @ColumnComment("小程序唯一id")
    private String openId;

    @ColumnComment("昵称")
    private String nickname;

    @ColumnComment("邮箱")
    private String email;

    @ColumnComment("手机号")
    private String phone;

    @ColumnComment("头像")
    private String avatar;

    // 游戏相关
    // 末日币
    @ColumnComment("末日币")
    @ColumnDefault("100")
    private Integer enderCoin;

    // vip 0 没有 1 vip
    @ColumnComment("vip")
    @ColumnDefault("0")
    private Integer vip;

    //等级
    @ColumnComment("等级")
    @ColumnDefault("1")
    private Integer level;

    // 经验值
    @ColumnComment("经验值")
    @ColumnDefault("0")
    private Integer exp;

    @ColumnComment("性别")
    @ColumnDefault("男")
    private String sex;

    //---------------直播相关三个值--------------
    @ColumnComment("钱包")
    @ColumnDefault("100000")
    private Long money;

    @ColumnComment("贡献值")
    @ColumnDefault("0")
    private Long contribution;

    @ColumnComment("等级")
    @ColumnDefault("1")
    private Integer grade;

    /**
     * 经验计算公式
     * 等级 * 等级 * 100 + 等级 = 当前等级升级需要的经验
     *  1 * 1 * 100 + 1 = 101
     *  2 * 2 * 100 + 2 = 402
     *  3 * 3 * 100 + 3 = 903
     *  ......
     *  50 * 50 * 100 + 50 = 250050
     *  100*100*100+100 = 1000100
     */
    @ColumnComment("经验")
    @ColumnDefault("0")
    private Long experience;

}
